<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Nav/index')}">用户主页</a></li>
        <li><a href="{:url('Nav/add')}">用户添加</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="get" action="{:url('Nav/index')}">
        查询:
        <input type="text" class="form-control" name="checkname" style="width: 240px;" value="{:input('request.user_login/s','')}" placeholder="请输入查询内容">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('Nav/index')}">清空</a>
    </form>
    <form method="post" class="js-ajax-form margin-top-20" action="{:url('Nav/order')}">
        <div class="table-actions">
            <button class="btn btn-sm btn-primary js-ajax-submit" type="submit">排序</button>
            <button class="btn btn-sm btn-success js-ajax-submit" type="submit"
                    data-action="{:url('Link/toggle',array('display'=>1))}" data-subcheck="true">显示
            </button>
            <button class="btn btn-sm btn-danger js-ajax-submit" type="submit"
                    data-action="{:url('Link/toggle',array('hide'=>1))}" data-subcheck="true">隐藏
            </button>
        </div>
        <php>$status=array("1"=>lang('DISPLAY'),"0"=>lang('HIDDEN'));</php>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="16"><label><input type="checkbox" class="js-check-all" data-direction="x"
                                             data-checklist="js-check-x"></label></th>
                <th width="50">排序</th>
                <th width="50">ID</th>
                <th>主题命名</th>
                <th width="50">图片</th>
                <th width="50">上级目录</th>
                <th width="120">跳转地址</th>
                <th width="50">创建时间</th>
                <th width="50">启用状态</th>
                <th width="50">操作</th>
            </tr>
            </thead>
            <tbody>
                <volist name ='data' id = 'v'>
                    <tr>
                        <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                                   value=""></td>
                        <td><input name='list_orders[{$v.id}]' class="input input-order mr5" type='text' size='3'
                                   value='{$v.list_order}'></td>
                        <td width="50">{$v.id}</td>
                        <td width="50">{$v.title}</td>
                        <td ><img class="image-thumbnail js-image-previewer" width="20px" src="{$v.image}"></td>
                        <td width="50">{$v.part_id}</td>
                        <td width="50">{$v.url}</td>
                        <td width="50">{$v.create_time}</td>
                        <td width="50">
                            <eq name="$v.switch" value="1">
                                <a href="{:url('Nav/totolgSwitch',['id'=>$v['id']])}" type="button" class="btn btn-success js-ajax-dialog-btn" data-msg="确定要进行相反操作吗？" >是</a>
                            <else/>
                                <a href="{:url('Nav/totolgSwitch',['id'=>$v['id']])}" type="button" class="btn btn-danger js-ajax-dialog-btn" data-msg="确定要进行相反操作吗？" >否</a>
                            </eq>
                        </td>
                        <td><a class="btn btn-xs btn-primary" href="{:url('Nav/edit',['id'=>$v['id']])}">编辑</a>

                            <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Nav/delete',['id'=>$v['id']])}">删除</a>
                        </td>
                    </tr>
                </volist>
            </tbody>
        </table>
        <div class="pagination">

        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
<script src="__STATIC__/js/js-image-previewer.js"></script>

<script>
    $(document).ready(function() {
        $('.toggle-switch').click(function() {
            var button = $(this);
            var id = button.data('id');
            $.post("{:url('News/toggleSwitch')}", {id: id}, function(data) {
                if (data.status === 1) {
                    if (data.switch === 1) {
                        button.removeClass('btn-danger').addClass('btn-success').text('是');
                    } else {
                        button.removeClass('btn-success').addClass('btn-danger').text('否');
                    }
                } else {
                    alert(data.msg);
                }
            }, 'json');
        });
    });
</script>
</body>
</html>
